$(document).ready(function() {
            var length,
                    currentIndex = 0,

                    length = $('.qh-focus-box .qh-focus-inner').length;

            //鼠标上悬时显示向前、向后翻按钮,停止滑动，鼠标离开时隐藏向前、向后翻按钮，开始滑动
            $('.qh-focus').hover(function() {
                $('.slider-page').show();
            }, function() {
                $('.slider-page').hide();
            });

            var preIndex = $(".qh-focus-inner.active").index();

            $('.arrow-left').click(function(){
                pre();
            });
            $('.arrow-right').click(function() {
                next();
            });

            /**
             * 向前翻页
             */
            function pre() {
                var preIndex = currentIndex;
                currentIndex = (--currentIndex + length) % length;
                play(preIndex, currentIndex);
                wth()
            }
            /**
             * 向后翻页
             */
            function next() {
                var preIndex = currentIndex;
                currentIndex = ++currentIndex % length;
                play(preIndex, currentIndex);
                wth()
            }
            /**
             * 从preIndex页翻到currentIndex页
             * preIndex 整数，翻页的起始页
             * currentIndex 整数，翻到的那页
             */
            function play(preIndex, currentIndex) {
                $('.qh-focus-box .qh-focus-inner').eq(preIndex).fadeOut(200).parent().children().eq(currentIndex).fadeIn(500);
                $('.qh-focus-inner').removeClass('active').eq(currentIndex).addClass('active');
            }

            /**
             * 手风琴效果
             */
            $('.qh-focus-inner li .qh-focus-tit').click(function(){

                var lgh = $('.qh-focus-inner.active li').length-1;
                var wth = $('.qh-focus-inner.active').width() - lgh * 40;

                $(this).parent().parent('li').stop().animate({width:wth+"px"},300).siblings().stop().animate({width:"40px"},300);
            });

            function wth(){
            	$('.qh-focus-inner.active li').css("width","40px");
                var lgh = $('.qh-focus-inner.active li').length-1;
                var wth = $('.qh-focus-inner.active').width() - lgh * 40;
                $('.qh-focus-inner li:first-child').css('width',wth+'px');
            }
            wth();
        });